package demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-03-21
 * Time: 20:23
 */
interface IFlying {
    static void fuc() {
        System.out.println("static flying");
    }
    void fly();
}
interface ISwimming {
    void swim();
}
interface IRunning {
    void run();
}
abstract class Animal {
    private String name;
    public int age;
    Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public abstract void eat();
}
class Dog extends Animal implements IRunning,ISwimming{
    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(this.getName()+" eat gouliang");
    }

    @Override
    public void run() {
        System.out.println(this.getName()+" 四条腿跑");

    }

    @Override
    public void swim() {
        System.out.println(this.getName()+" 四条腿游泳");

    }
}
class Birds extends Animal implements IFlying {

    public Birds(String name,int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(this.getName() + " 正在吃虫子");
    }

    @Override
    public void fly() {
        System.out.println(this.getName()+ " 飞呢");
    }
}
class Robot implements IRunning {
    @Override
    public void run() {
        System.out.println("robot is running");
    }
}
public class Test {
    public static void testSwim(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void testRun(IRunning iRunning){
        iRunning.run();
    }

    public static void testFly(IFlying iFlying){
        iFlying.fly();
    }

    public static void test1(Animal animal){
        animal.eat();
    }

    public static void main2(String[] args) {
        testFly(new Birds("bird",1));
        testRun(new Dog("dog",2));
        testSwim(new Dog("dog",2));
        testRun(new Robot());
    }
    public static void main1(String[] args) {
        test1(new Birds("bird",1));
        test1(new Dog("dog",2));
    }

    public static void main(String[] args) {
    }
}
    abstract interface A {
    void testA();
}
interface B {
    void  testB();
}
interface C extends A,B {
    void testC();
}
class D implements C {

    @Override
    public void testA() {

    }

    @Override
    public void testB() {

    }

    @Override
    public void testC() {

    }
}
